// .txt

beginzonescript;

variables;

short im_hostile = 0;
short last_abil;
short counter = 0;
short set_ter1 = 0;

body;

beginstate INIT_STATE;
	last_abil = get_current_tick();

	set_name(2800,"Vengeful Spirit");
	set_boss_level(2800,1);
	
	set_name(30005,"Arena Warrior");
	set_name(2850,"Pitmaster Grenich");

//	set_attack_range(,);

//	add_ability(short which_char_or_group,short which_slot,short which_ability,0);

//	if (is_town_clear(ME))
//		clean_up_town();

	sf(28,24,0);
	sf(28,19,0);
	
	if (gf(28,11) > 0) {
		erase_char(30001);
		}
		else {
			sf(28,10,0);
			sf(28,13,0);
			if (char_ok(2800) == FALSE)
				spawn_creature(2800);
			}
	if (gf(28,12) > 0) {
		erase_char(30005);
		erase_char(30006);
		erase_char(30007);
		erase_char(2850);
		}
	if (gf(28,11) > 0) {
		erase_char(2800);
		}
	if (gf(28,15) == 0)
		sf(28,25,0);		
	if (gf(28,16) == 0)
		sf(28,26,0);		
	if (gf(28,17) == 0)
		sf(28,27,0);		
	break;

beginstate EXIT_STATE;

break;

beginstate START_STATE;
	//if ((set_ter1 == 0) && (gf(0,0) > 0)) {
	//	set_ter1 = 1;
	//	set_terrain(,,,);
	//	}
		
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(2850,"All may be tested.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(2850,"Hello, intruder.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(2850,"Prepare the next match.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(2850,"Clean up the blood.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(2850,"Order more scorpions.");

	if ((on_which_layer() == 1) && (gf(28,19) == 1) && (party_within_dist(17,13,4))) {
		if (gf(28,14) == 1) {
			sf(28,24,0);
			sf(28,25,1);
			sf(28,19,2);
			activate_hidden_group(8);
			if (difficulty() > 0)
				set_boss_level(30008,1);
			set_percent_adjust(30008,2,50);
			set_percent_adjust(30008,3,100);
			force_char_status(30008,4,5 + difficulty());
			set_level(30008,15);
			begin_talk_mode(21);
			}
		if (gf(28,14) == 2) {
			sf(28,24,0);
			sf(28,26,1);
			sf(28,19,2);
			activate_hidden_group(9);
			if (difficulty() > 0)
				set_boss_level(30009,1);
			set_percent_adjust(30009,2,100);
			set_percent_adjust(30009,3,50);
			force_char_status(30009,4,5 + difficulty());
			set_level(30009,17);
			begin_talk_mode(21);
			}
		if (gf(28,14) == 3) {
			sf(28,24,0);
			sf(28,27,1);
			sf(28,19,2);
			activate_hidden_group(10);
			set_level(30010,19);
			set_percent_adjust(30010,2,75);
			set_percent_adjust(30010,3,75);
			force_char_status(30010,4,5 + difficulty());
			if (difficulty() > 0)
				set_boss_level(30010,1);
			begin_talk_mode(21);
			}
		if (gf(28,14) == 4) {
			sf(28,24,0);
			sf(28,19,2);
			spawn_creature(2876);
			begin_talk_mode(22);
			}
		
		}
	if (gf(28,19) == 2) {
		if ((gf(28,14) == 1) && (num_chars_in_group(8) == 0)) {
			sf(28,24,1);
			sf(28,15,1);
			sf(28,19,0);
			begin_talk_mode(23);
			}
		if ((gf(28,14) == 2) && (num_chars_in_group(9) == 0)) {
			sf(28,24,1);
			sf(28,16,1);
			sf(28,19,0);
			begin_talk_mode(23);
			}
		if ((gf(28,14) == 3) && (num_chars_in_group(10) == 0)) {
			sf(28,24,1);
			sf(28,17,1);
			sf(28,19,0);
			begin_talk_mode(23);
			}
		}
	
	//if (gf(,) < 2) {
	//	inc_flag(,,1);
	//	if (gf(,) == 2)
	//		begin_talk_mode();
	//	}

	//if (((is_combat()) && (tick_difference(last_abil,get_current_tick()) > 0)) || ((is_town()) && (tick_difference(last_abil,get_current_tick()) > 5))) {
	//	last_abil = get_current_tick();
	//	if ((gf(,) > 0) && (gf(,) < 100))
	//	}
break;

beginstate 10;
break;

beginstate 11;
break;

beginstate 12;
break;

beginstate 13;
break;

//	print_str("");
//	set_terrain_string_range(".",1);
//	set_terrain_string_range("The sign says - .",1);
